﻿<UserControl x:Class="SLExtensions.Showcase.PageBindingComparer"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:sled="clr-namespace:SLExtensions.Data;assembly=SLExtensions.Data"
    xmlns:scControllers="clr-namespace:SLExtensions.Showcase.Controllers;assembly=SLExtensions.Showcase"
    xmlns:s="clr-namespace:SLExtensions.Showcase"
   >
	<UserControl.Resources>
		<s:ListImageObj x:Name="Images">
			<s:ImageObj Id="1" OldId="1" Titre="Titre 1" OldTitre="Titre 1" />
			<s:ImageObj Id="2" OldId="2" Titre="Titre 2" OldTitre="Titre 2" />
		</s:ListImageObj>
		<s:CustomCompare x:Name="customCompare"/>
		<scControllers:PageCommandController x:Name="controller"/>
		<ControlTemplate x:Name="TextBoxTemplate1" TargetType="TextBox">
			<StackPanel Orientation="Horizontal">
				<TextBox  Width="188" Foreground="Red" Text="{Binding Path=Titre, Mode=TwoWay}"  TextChanged="TextBox_TextChanged"></TextBox>
				<Grid Height="12" Width="12">
					<Path Height="12" HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Fill="#FFFFFFFF" Stretch="Fill" Stroke="#FFFF0000" StrokeThickness="3" Data="M126.5,104.5 L96.423607,135.5625"/>
					<Path Height="12" HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Fill="#FFFFFFFF" Stretch="Fill" Stroke="#FFFF0000" StrokeThickness="3" Data="M96.920074,106.8371 L125.18851,135.77399"/>
				</Grid>						
			</StackPanel>
		</ControlTemplate>
		<ControlTemplate x:Name="TextBoxTemplate2" TargetType="TextBox">
				<TextBox Foreground="Red" Text="{Binding Path=Id, Mode=TwoWay}" TextChanged="TextBoxId_TextChanged"></TextBox>
		</ControlTemplate>
	</UserControl.Resources>
	<Grid x:Name="LayoutRoot" Background="White" >
		<ItemsControl HorizontalAlignment="Left" ItemsSource="{StaticResource Images}" >
			<ItemsControl.ItemTemplate>
				<DataTemplate>
					<StackPanel Orientation="Horizontal">
						<TextBox Width="50" Text="{Binding Path=Id, Mode=TwoWay}" sled:BindingComparer.Template="{StaticResource TextBoxTemplate2}" sled:BindingComparer.ValueA="{Binding Path=Id}" sled:BindingComparer.ValueB="{Binding Path=OldId}" sled:BindingComparer.Compare="Custom"  sled:BindingComparer.CustomComparer="{StaticResource customCompare}" TextChanged="TextBoxId_TextChanged" />
						<TextBox Width="200" Text="{Binding Path=Titre, Mode=TwoWay}" sled:BindingComparer.Template="{StaticResource TextBoxTemplate1}" sled:BindingComparer.ValueA="{Binding Path=Titre}" sled:BindingComparer.ValueB="{Binding Path=OldTitre}" sled:BindingComparer.Compare="Diff"  TextChanged="TextBox_TextChanged" />		
					</StackPanel>
				</DataTemplate>
			</ItemsControl.ItemTemplate>
		</ItemsControl>
		
    </Grid>
</UserControl>
